/*
 * Copyright (c) 2010, Nikolaus Moll
 * All rights reserved.
 */
package net.miblounge.gradecalculator.core.enums;

import java.util.ArrayList;


public abstract class AbstractEnumTypeList<T extends AbstractEnumType> extends ArrayList<T> {
	private static final long serialVersionUID = -1150594815117338012L;

	@Override
	public String toString()
	{
		if (isEmpty()) {
			return "";
		}
		
		final StringBuilder result = new StringBuilder();
		String separator = "";
		for (T type : this) {
			result.append(separator + type.getAbbreviation());
			separator = "+";
		}
		return result.toString();
	}

	public String toDetailedString()
	{
		if (isEmpty()) {
			return "";
		}
		
		final StringBuilder result = new StringBuilder();
		String separator = "";
		for (T type : this) {
			result.append(separator + type.getName());
			separator = ", ";
		}
		return result.toString();
	}
}
